using System;
using System.Web;
using System.Web.Routing;

namespace ShortUrl.Constraints
{
    public class ExpectedValuesConstraint : IRouteConstraint
    {

        //public ExpectedValuesConstraint(params string[] values)
        //{
        //    _values = values;
        //}
        public bool Match(HttpContextBase httpContext, Route route,
           string parameterName, RouteValueDictionary values,
           RouteDirection routeDirection)
        {
            object value;
            if (!values.TryGetValue(parameterName,out value))
            {
                return false;
            }
            if (value.ToString().Length == 8)
            {
                return true;
            }
            else return false;
        }
    }
}